package top.psjj.ssm.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.DigestUtils;
import top.psjj.ssm.entity.User;
import top.psjj.ssm.mapper.UserMapper;
import top.psjj.ssm.service.UserService;

@Service
@Transactional
public class UserServiceImpl implements UserService {
    @Autowired
    private UserMapper userMapper;
    @Override
    public boolean insertUser(User user) {
        user.setPassword(DigestUtils.md5DigestAsHex(user.getPassword().getBytes()));
        boolean tag = userMapper.insertUser(user);
        //int i = 1/0;
        return tag;
    }
}
